home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / USEFUL_C / PASSTR__ / PSTRSPN.C < prev   
Text File  |  1990-04-13  |  642b  |  37 lines

  1. /****************************************************************************
  2.  *
  3.  * FILE:    Pstrspn.c
  4.  * CREA:    Sven Axelsson, GU
  5.  * MODF:    fredag 13 april 1990 @ 12.36.11
  6.  * HIST:    90-04-13 (1.0)    First version.
  7.  *
  8.  ****************************************************************************/
  9.  
  10. # include    "PasStrs.h"
  11.  
  12.  
  13. short
  14. Pstrspn(
  15.     register Str255            s1,
  16.     register Str255            s2 )
  17. {
  18.     register unsigned int    i,
  19.                             j;
  20.     unsigned int            l1 = s1[0],            
  21.                             l2 = s2[0];
  22.     
  23.     if( l2 == 0 ) {
  24.         return( 0 );
  25.     }
  26.     
  27.     for( i = 1; i <= l1; i++ ) {
  28.         for( j = 1; j <= l2; j++ ) {
  29.             if( s1[i] != s2[j] ) {
  30.                 goto exit;
  31.             }
  32.         }
  33.     }
  34.  
  35. exit:    
  36.     return( --i );
  37. }